/*
 * Licensed to the Tai Ping Jin Ke
 *
 * Copyright (c) 2022 .
 * All rights reserved.
 * 项目名称：呼叫中心-通用处理层-任务调度
 * 版权说明：本软件属太平金融科技服务(上海)有限公司所有，在未获得太平金融科技服务(上海)有限公司正式授权情况下，任何企业和个人，不能获取、阅读、安装、传播本软件涉及的任何受知识产权保护的内容。
 */
package com.taiping.cc.job.converter;

import com.taiping.cc.job.dataobject.HttpRequestConfigDO;
import com.taipingframework.utility.http.ServiceConfigInfo.ServiceRequestConfigInfo;

public class ServiceRequestConfigInfoConverter {

    /**
     * 数据对象 HttpRequestConfigDO 转 数据传输对象 ServiceRequestConfigInfo
     */
    public static ServiceRequestConfigInfo convert(HttpRequestConfigDO httpRequestConfig) {
        ServiceRequestConfigInfo serviceRequestConfigInfo = new ServiceRequestConfigInfo();
        if (httpRequestConfig == null) {
            return serviceRequestConfigInfo;
        }
        serviceRequestConfigInfo.setRequestMethod(httpRequestConfig.getRequestMethod());
        serviceRequestConfigInfo.setRequestUrl(httpRequestConfig.getServiceUrl());
        serviceRequestConfigInfo.setContentType(httpRequestConfig.getMediaType());
        serviceRequestConfigInfo.setRequestBody(httpRequestConfig.getJsonBody());
        return serviceRequestConfigInfo;
    }

}
